package com.example.springboot.config;

import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/*
 * 功能：热部署——解决问题：上传图片后端需要重启才能显示，现在直接就能访问
 * 日期：2024-5-9 17:10
 * 作者：RabbitQ
 */
@Configuration
public class WebConfig implements WebMvcConfigurer {
    @Override
    public void addResourceHandlers(ResourceHandlerRegistry registry) {
        //获取文件的真实路径
        String path = System.getProperty("user.dir") +
                "\\src\\main\\resources\\static\\signatureImages\\";

        //       /images/**是对应resource下工程目录
        registry.addResourceHandler("/signatureImages/**").addResourceLocations("file:"+path);

    }
}

